#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstring>

using namespace std;

int num[1024], result[1024], temp[1024];

void mulresult()
{
    int i, j;
    memset(temp, 0, sizeof(temp));
    for (i = 1; i <= 500; i++)
    {
        for (j = 1; j <= 500; j++)
        {
            temp[i + j - 1] += result[i] * num[j];
        }
    }
    for (i = 1; i <= 500; i++)
    {
        temp[i + 1] += temp[i] / 10;
        temp[i] %= 10;
    }
    memcpy(result, temp, sizeof(temp));
}

void mulnum()
{
    int i, j;
    memset(temp, 0, sizeof(temp));
    for (i = 1; i <= 500; i++)
    {
        for (j = 1; j <= 500; j++)
        {
            temp[i + j - 1] += num[i] * num[j];
        }
    }
    for (i = 1; i <= 500; i++)
    {
        temp[i + 1] += temp[i] / 10;
        temp[i] %= 10;
    }
    memcpy(num, temp, sizeof(temp));
}

int main(int argc, char const *argv[])
{
    int p, i;
    cin >> p;
    cout << (int)(log10(2) * p + 1);
    num[1] = 2;
    result[1] = 1;
    while (p)
    {
        if (p % 2)
        {
            mulresult();  
        }
        p /= 2;
        mulnum();
    }
    result[1]--;
    for (i = 500; i > 0; i--)
    {
        if (i % 50 == 0)
        {
            cout << "\n";
        }
        cout << result[i];
    }
    
    return 0;
}
